#include <stdarg.h>

#include "Error.h"

namespace Signal
{
	Error::Error (std::string error, ...)
	:
		m_line		(0),
		m_character (0)
	{
		char temp_buffer[ERROR_MAX_LENGTH];

		va_list args;
		va_start (args, error);

		vsprintf_s (temp_buffer, error.c_str (), args);

		va_end (args);

		m_error = std::string (temp_buffer);
	}

	Error::Error (uint32_t line, uint32_t character, std::string error, ...)
	:
		m_line		(line),
		m_character (character)
	{
		char temp_buffer[ERROR_MAX_LENGTH];

		va_list args;
		va_start (args, error);

		vsprintf_s (temp_buffer, error.c_str (), args);

		va_end (args);

		m_error = std::string (temp_buffer);
	}

	std::string Error::error ()
	{
		return m_error;
	}

	uint32_t Error::line ()
	{
		return m_line;
	}

	uint32_t Error::character ()
	{
		return m_character;
	}
}